const db = require('../db')
exports.item = (req, res) => {
  // SELECT a.*,score.score from (SELECT *from student FULL  JOIN course ) as a LEFT JOIN score ON score.courseId = a.courseId and score.stuId = a.stuId
  // const sql = "select company.*,jobs*,recruiter.* from company,jobs,recruiter where (company.id=jobs.company_id,recruiter.id=jobs.recruiter_id) limit 15 offset ?"
  // const sql = "select company.*,jobs.*,recruiter.* from company as company,jobs,recruiter as recruiter where (company.id=jobs.company_id and recruiter.id=jobs.recruiter_id) limit 15 offset ?"
  const sql = "select company.company_id,company.scale,company.short_name,company.stage,company.district,company.address,jobs.title,jobs.tags,jobs.workEXP,jobs.edu,jobs.job_id,jobs.company_id,jobs.recruiter_id,jobs.salary,recruiter.recruiter_id,recruiter.position,recruiter.r_name,recruiter.r_pic from company as company,jobs,recruiter as recruiter where (company.company_id=jobs.company_id and recruiter.recruiter_id=jobs.recruiter_id) limit 15 offset ?"

  let {offset} = req.query
  db.query(sql,parseInt(offset),(err,result) => {
    if(err) return res.send({
      code:400,
      msg:err.message
    })
    res.send({
      code:200,
      data:result
    })
  })
}
exports.detail=(req,res) => {
  const sql = ""
  db.query(sql,(err,result) => {
    if(err) return res.send({
      code:400,
      msg:err.message
    })
    console.log(123)
  })
}